 |
|
 |
Subject: Lotusscript left margin issue |
 |
 |
 |
Product Area: Domino Designer on Eclipse (DDE) |
 |
Technical Area: Application Development |
 |
Platform: ALL |
 |
Release: 8.5.2 |
 |
Reproducible: -Reproducibility- |
 |
 |
 |
 |
Good afternoon all,
I have a button that is used to populate our users signature and includes a logo. This works fine until a user edits his signature. Once edited the text shifts out of whack. I'm hoping to modify the existing code to force everything to stay at a one inch left margin. The error occurs on the line that reads "richStyle.LeftMargin = RULER_ONE_INCH"
Any help would be appreciated! Thanks in advance
Sub Click(Source As Button)
Dim sess As New NotesSession
Dim mailfile As NotesDatabase
Dim profiledoc As NotesDocument
Dim nitem As NotesItem
Dim rtitem As NotesRichTextItem
Dim stream As NotesStream
Dim mimeItem As NotesMIMEEntity
Dim header As NotesMIMEHeader
Dim child As NotesMIMEEntity
Dim fileFormat As String
Dim rtitemB As NotesRichTextItem
Dim Title As Variant
Dim sTitle As String
Dim Extension As Variant
Dim sExtension As String
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Dim myName As New NotesName(sess.EffectiveUserName)
Set mailfile = sess.Currentdatabase
Set profiledoc = mailfile.GetProfileDocument("CalendarProfile")
Dim richStyle As NotesRichTextStyle
Set richStyle = sess.CreateRichTextStyle
Dim richText As New NotesRichTextItem(profiledoc, "Signature_Rich")
richStyle.NotesFont = 2
richStyle.FontSize = 10
richStyle.LeftMargin = RULER_ONE_INCH
Dim richStyle2 As NotesRichTextStyle
Set richStyle2 = sess.CreateRichTextStyle
Dim richText2 As New NotesRichTextItem(profiledoc, "Signature_Rich")
richStyle2.NotesFont = 2
richStyle2.FontSize = 9
richStyle2.LeftMargin = RULER_ONE_INCH
Title = Evaluate(|@NameLookup([Exhaustive];@UserName;"Title")|)
If Len(Title(0)) > 0 Then
sTitle = Title(0)
Else
sTitle = Title(1)
End If
Extension = Evaluate(|@NameLookup([Exhaustive];@UserName;"OfficePhoneNumber")|)
If Len(Extension(0)) > 0 Then
sExtension = Extension(0)
Else
sExtension = Extension(1)
End If
'Create a RTF via MIME to embedd the graphic vs attacheming
Call profiledoc.RemoveItem("Signature_Rich")
Call profiledoc.RemoveItem("DummyRichText")
Call profiledoc.save(False, False) 'JUST To REFRESH
Set stream = sess.CreateStream
Call stream.Open("M:\Drop to Sec\SaxBST.jpg")
Set mimeItem = profiledoc.CreateMIMEEntity("DummyRichText")
Set header = mimeItem.CreateHeader("Content-Type")
Call header.SetHeaderVal("multipart/mixed")
Set child = mimeItem.CreateChildEntity() 'Set childEntity = richTextItemObj.CreateChildEntity()
fileFormat = "image/jpeg" 'Other formats are “image/gif” “image/bmp”
Call child.Setcontentfrombytes(stream, fileformat, 1730)
Call stream.Close()
Call profiledoc.save(False, False) 'JUST To REFRESH
Set rtitemB = profiledoc.GetFirstItem("DummyRichText")
'Set rtItem = profiledoc.Createrichtextitem("Signature_Rich")
Set rtItem = profiledoc.CreateRichTextitem("Signature_Rich")
' Set Font Face and Size
Call rtItem.AppendStyle(richStyle)
'add the rich text content
Call rtItem.Addnewline(4)
Call rtItem.Appendtext(myName.Common)
Call rtItem.Addnewline(1)
Call rtItem.Appendtext(sTitle)
Call rtItem.Addnewline(1)
Call rtItem.Addnewline(2)
' Change Font Size to 9 pt
Call rtItem.AppendStyle(richStyle2)
Call rtItem.Appendtext("Disclaimer Text")
Call rtItem.Addnewline(1)
Set rtitemB = profiledoc.GetFirstItem("DummyRichText")
Call rtItem.AppendRTItem( rtitemB )
Call rtItem.Addnewline(2)
Call rtitemB.Remove()
'set enable the signature and for it to be a richt text signature
Set nitem = profiledoc.Replaceitemvalue("SignatureOption", "3")
'Set nitem = profiledoc.Replaceitemvalue("EnableSignature", "1")
Call profiledoc.Save(True, False)
Call uidoc.Close
Messagebox "Your Lotus Notes signature has been modified"
Call workspace.ComposeDocument( "", "", "Memo" )
REM {Send Email Confirmation to IT}
Dim Session As New NotesSession
Dim mdoc As NotesDocument
Dim db2 As New NotesDatabase("" , "names.nsf")
Set mdoc = db2.createdocument
mdoc.form = "Memo"
mdoc.sendto = "Jonathan Jones"
mdoc.subject = session.commonusername & " ran the Signature Update script!!"
mdoc.send False
End Sub
 
Feedback number WEBB9CHT3J created by ~Elizabeth Opfoobergetsi on 10/15/2013

Status: Open
Comments:

Lotusscript left margin issue (~Elizabeth Opfo... 15.Oct.13)
. . What is the exact error? (~Ned Nimfanakon... 15.Oct.13)
. . . . Error reads... (~Elizabeth Opfo... 16.Oct.13)
. . . . . . Wrong class (~Bella Kinilyad... 16.Oct.13)
. . you haven't defined RULER_ONE_INCH ... (~Judy Ektumizen... 16.Oct.13)
. . . . He doesn't need to in this case (~August Cispone... 16.Oct.13) |
|  |
|